package cn.hotel.service.impl;

import cn.hotel.entity.OrderType;
import cn.hotel.mapper.OrderMapper;
import cn.hotel.mapper.OrderTypeMapper;
import cn.hotel.entity.OrderType;
import cn.hotel.mapper.OrderTypeMapper;
import cn.hotel.service.OrderTypeService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

import java.util.List;

@Service
public class OrderTypeServiceImpl implements OrderTypeService {
    @Autowired
    private OrderTypeMapper orderTypeMapper;
//    @Override
//    public List<OrderType> queryAllOrdersType() {
//        return orderTypeMapper.getAllOrderType();
//    }

    @Override
    public PageInfo<OrderType> queryOrderTypeList(Integer page, Integer pageSize) {
        PageHelper.startPage(page,pageSize);
        PageInfo<OrderType> pageInfo = new PageInfo<>(orderTypeMapper.getAll());
        return pageInfo;
    }

    @Override
    public void insertOrderType(OrderType orderType) {
        orderTypeMapper.insertOrderType(orderType);
    }

    @Override
    public OrderType queryOrderTypeById(int id) {
        return orderTypeMapper.queryOrderTypeById(id);
    }

    @Override
    public void updateOrderType(OrderType orderType) {
        orderTypeMapper.updateOrderType(orderType);
    }

    @Override
    public void deleteOrderType(int id) {
        orderTypeMapper.deleteOrderType(id);
    }

    @Override
    public List<OrderType> getAll() {

        List<OrderType> all = orderTypeMapper.getAll();
        return all;
    }
}
